/**
 * https://codeforces.com/problemset/problem/1840/D
 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
set<ll> st;
int n;
bool check(ll mid){
	ll d=*st.begin()+mid;
	int k=1;
	for(auto x:st){
		if(abs(x-d)>mid){
			d=x+mid;
			k++;
		}
	}
	return k<=3;
}
int main()
{
	int t;
	cin>>t;
	while(t--){
		cin>>n;
		for(int i=0;i<n;++i){
			ll d;
			cin>>d;
			st.insert(d);
		}
		if(st.size()<=3){
			cout<<0<<endl;
			st.clear();
			continue;
		}
		ll l=0;
		ll r=*st.rbegin();
		ll ans=0;
		while(l<=r){
			ll mid=l+(r-l)/2;
			if(check(mid)){
				ans=mid;
				r=mid-1;
			}
			else{
				l=mid+1;
			}
		}
		cout<<ans<<endl;
		st.clear();
	}
	return 0;
}